<?php

include(dirname(__FILE__).'/../../bootstrap/functional.php');

$browser = new sfTestFunctional(new sfBrowser());
$browser->setTester('doctrine', 'sfTesterDoctrine');

$browser->info("Inscription");
$browser->
        info("1- Obtenir le formulaire d'inscription")->
        get("/joueur/inscription.html")->
        with("request")->begin()->
            isParameter("module", "sfGuardRegister")->
            isParameter("action", "index")->
        end()->
        with("response")->begin()->
            isRedirected(false)->
            checkElement("form", true)->
        end()->

        info("2- Remplir le forumulaire")->
        click("Inscription", array("ktd_player_register" => array(
            'username'          => 'lambda',
            'password'          => 'lambda_mdp',
            'password_again'    => 'lambda_mdp',
            'email_address'     => 'lambda@gmail.com'
        )))->

        info("3- Envois du formulaire et traitement")->
        with('request')->begin()->
            isParameter("module", "sfGuardRegister")->
            isParameter("action", "index")->
        end()->
        with('form')->begin()->
            hasErrors(false)->
        end()/*->

        info("4- Envois d'un email pour confirmer l'inscription.")->
        with('mailer')->begin()->
            debug()->
        end()*/->info("Executer user:delete lambda pour nettoyer la BDD");


        

        
        